package com.teradyne.merlin2.ui.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class TopMenuViewImpl extends Composite implements TopMenuView {

	private static TopMenuImplUiBinder uiBinder = GWT.create(TopMenuImplUiBinder.class);

	interface TopMenuImplUiBinder extends UiBinder<Widget, TopMenuViewImpl> {
	}

	@UiField
	Button btnHome;

	@UiField
	Button btnOrder;

	@UiField
	Button btnQuote;

	@UiField
	Button btnServices;

	@UiField
	Button btnWorklist;

	private Presenter presenter;

	public TopMenuViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}
	
	@UiHandler("btnHome")
	void onHomeClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onHomeClicked();
		}
	}
	
	@UiHandler("btnOrder")
	void onOrderClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onOrderClicked();
		}
	}
	
	@UiHandler("btnQuote")
	void onQuoteClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onQuoteClicked();
		}
	}
	
	@UiHandler("btnServices")
	void onServiceClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onServiceClicked();
		}
	}
	
	@UiHandler("btnWorklist")
	void onWorklistClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onWorklistClicked();
		}
	}

//	@Override
//	public HasClickHandlers getHandlerHome() {
//		return btnHome;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerOrder() {
//		return btnOrder;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerQuote() {
//		return btnQuote;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerServices() {
//		return btnServices;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerWorklist() {
//		return btnWorklist;
//	}

}
